package com.ymatou.shop.ui.view.item;

import java.util.Date;

import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewDebug.IntToString;
import android.widget.CheckedTextView;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ymatou.shop.R;
import com.ymatou.shop.cache.ImageCache;
import com.ymatou.shop.model.Address;
import com.ymatou.shop.model.Product;
import com.ymatou.shop.ui.activity.ShowProductImageActivity;
import com.ymatou.shop.util.DateUtil;
import com.ymatou.shop.util.DeviceUtil;
import com.ymatou.shop.util.GlobalUtil;
import com.ymatou.shop.util.StringUtil;

public class AddressItemView extends RelativeLayout {
	
	
	public AddressItemView(Context context) {
		super(context);

		
		initAddressItemView();
	}
	
	public AddressItemView(Context context, AttributeSet attrs) {
	  super(context, attrs);
	  initAddressItemView();
  }

	private TextView mUserAddressTextView;
	private TextView mChangeAddressTextView;
	private CheckedTextView mCheckedTextView;
	
	private Address mProduct;

	
	
	
	

	private void initAddressItemView() {
		LayoutInflater.from(getContext()).inflate(R.layout.address_item, this);
		
		
		mUserAddressTextView = (TextView) findViewById(R.id.user_address_textview);
		mChangeAddressTextView = (TextView) findViewById(R.id.change_textview);
		mCheckedTextView = (CheckedTextView) findViewById(R.id.checkedtextview);
		
	}
	
	public void setData(Address product) {
		mProduct = product;
		mCheckedTextView.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				
				mCheckedTextView.toggle();
			}
		});
		mUserAddressTextView.setText(product.mArea + product.mDetailAddress + product.mAddressee + product.mPhone);
		
	}
	
}
